package com.tools.photo.ui.widget;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;

public class SpaceItemDecoration extends RecyclerView.ItemDecoration{
  
        private int space;  
  
        public SpaceItemDecoration(int space) {
            this.space = space;  
        }  
  
        @Override  
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
            int position=parent.getChildAdapterPosition(view);
            if (position%2==0){
                outRect.right=space;
            }
            outRect.bottom=space;
        }  
    }  